package com.hog.enums;

/**
 * 大乐透规则枚举类
 *
 * @author 唐晴
 * @date 2020/12/23
 */
public enum DltRuleEnum {
    PRIZE_1("5+2", "一等奖: 发财了"),
    PRIZE_2("5+1", "二等奖: 发财了"),
    PRIZE_3("5+0", "三等奖: 奖金10000"),
    PRIZE_4("4+2", "四等奖: 奖金3000"),
    PRIZE_5("4+1", "五等奖: 奖金300"),
    PRIZE_6("3+2", "六等奖: 奖金200"),
    PRIZE_7("4+0", "七等奖: 奖金100"),
    PRIZE_8("3+1", "八等奖: 奖金15"),
    PRIZE_8_2("2+2", "八等奖: 奖金15"),
    PRIZE_9("3+0", "九等奖: 奖金5"),
    PRIZE_9_1("2+1", "九等奖: 奖金5"),
    PRIZE_9_2("1+2", "九等奖: 奖金5"),
    PRIZE_9_3("0+2", "九等奖: 奖金5"), ;

    private String rule;
    private String prizeName;

    DltRuleEnum(String rule, String prizeName) {
        this.rule = rule;
        this.prizeName = prizeName;
    }

    public static String getPrizeNameByRule(String rule) {
        DltRuleEnum[] values = DltRuleEnum.values();
        for (DltRuleEnum ruleEnum : values) {
            if (ruleEnum.getRule().equals(rule)) {
                return ruleEnum.getPrizeName();
            }
        }

        return "未中奖, 加油!";
    }

    public String getRule() {
        return rule;
    }

    public void setRule(String rule) {
        this.rule = rule;
    }

    public String getPrizeName() {
        return prizeName;
    }

    public void setPrizeName(String prizeName) {
        this.prizeName = prizeName;
    }
}
